#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;

namespace fastio{
    struct{template<typename T>operator T(){
        T x=0;char f=0,c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=1;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+(c^48);c=getchar();}
        return f?-x:x;
    }}in;int stk[40],tp;
    template<typename T>void out(T x,char c=0){
        if(x<0)putchar('-'),x=-x;
        do stk[++tp]=x%10,x/=10;while(x);
        while(tp)putchar(stk[tp--]^48);
        if(c)putchar(c);
    }
}using fastio::in;using fastio::out;

const int N = 1000005;
vector<int> g[N];
int inn[N],ans[N];
int n;

int main(){
    freopen("choice.in","r",stdin);
    freopen("choice.out","w",stdout);
    n = in;
    for(int k=1;k<n;k++){
        int a = in,b = in;
        g[a].push_back(b);
        g[b].push_back(a);
        inn[a]++,inn[b]++;
    }
    for(int k=1;k<=n;k++)
        inn[k]--;
    priority_queue<int> q;
    for(int k=1;k<=n;k++)
        if(!inn[k])
            q.push(k);
    for(int k=n;k;k--){
        int u = q.top();
        q.pop();
        ans[k] = u;
        for(int v:g[u])
            if(!(--inn[v]))
                q.push(v);
    }
    for(int k=1;k<=n;k++)
        out(ans[k],' ');
    return 0;
}